Page({
  goLogin() {
    wx.navigateTo({
      url: '/pages/login/index',
    })
  },
  onLoad() {
    this.getUserInfo()
  },
  async getUserInfo() {
    const {
      code,
      data,
      message
    } = await wx.http.get('/userInfo')
    if (code !== 10000) return wx.utils.toast(message)
    this.setData({
      userInfo: {
        nickName: data.nickName,
        avatar: data.avatar
      }
    })
  }
})